import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '申请人',
    align: 'center',
    dataIndex: 'createBy',
  },
  {
    title: '申请日期',
    align: 'center',
    dataIndex: 'createTime',
  },
  {
    title: '申请原因',
    align: 'center',
    dataIndex: 'reason',
  },
  {
    title: '申请状态',
    align: 'center',
    dataIndex: 'status_dictText',
  },
  {
    title: '审批时间',
    align: 'center',
    dataIndex: 'approvalTime',
  },
  {
    title: '审批人',
    align: 'center',
    dataIndex: 'approvalBy_dictText',
  },
  {
    title: '审批意见',
    align: 'center',
    dataIndex: 'approvalOpinion',
  },
  {
    title: '施封位置',
    align: 'center',
    dataIndex: 'position_dictText',
  },
  {
    title: '设备id',
    align: 'center',
    dataIndex: 'deviceId',
  },
  {
    title: '铅封ID',
    align: 'center',
    dataIndex: 'sealLeadId',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '申请人',
    field: 'createBy',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: '申请状态',
    field: 'status',
    component: 'JSelectMultiple',
    componentProps: {
      dictCode: 'seal_lead_unseal_apply_status',
    },
    //colProps: {span: 6},
  },
  {
    label: '审批人',
    field: 'approvalBy',
    component: 'JSelectUser',
    componentProps: {},
    //colProps: {span: 6},
  },
  {
    label: '铅封ID',
    field: 'sealLeadId',
    component: 'Input',
    //colProps: {span: 6},
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '申请原因',
    field: 'reason',
    component: 'Input',
  },
  {
    label: '申请状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'seal_lead_unseal_apply_status',
    },
  },
  {
    label: '审批时间',
    field: 'approvalTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  {
    label: '审批人',
    field: 'approvalBy',
    component: 'JSelectUser',
    componentProps: {},
  },
  {
    label: '审批意见',
    field: 'approvalOpinion',
    component: 'Input',
  },
  {
    label: '施封位置',
    field: 'position',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'seal_position',
    },
  },
  {
    label: '设备id',
    field: 'deviceId',
    component: 'Input',
  },
  {
    label: '铅封ID',
    field: 'sealLeadId',
    component: 'Input',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  createBy: { title: '申请人', order: 0, view: 'text', type: 'string' },
  createTime: { title: '申请日期', order: 1, view: 'datetime', type: 'string' },
  reason: { title: '申请原因', order: 2, view: 'text', type: 'string' },
  status: { title: '申请状态', order: 3, view: 'number', type: 'number', dictCode: 'seal_lead_unseal_apply_status' },
  approvalTime: { title: '审批时间', order: 4, view: 'datetime', type: 'string' },
  approvalBy: { title: '审批人', order: 5, view: 'sel_user', type: 'string' },
  approvalOpinion: { title: '审批意见', order: 6, view: 'text', type: 'string' },
  position: { title: '施封位置', order: 7, view: 'number', type: 'number', dictCode: 'seal_position' },
  deviceId: { title: '设备id', order: 8, view: 'text', type: 'string' },
  sealLeadId: { title: '铅封ID', order: 9, view: 'text', type: 'string' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
